<!--{include header}-->
<script>

	//添加商家
	function addone()
	{
		var tot = new Date().getTime();
        var pm = {'t':tot};
		var url = geturl('sysmerchant', 'add', pm);
		floatPage(url, '添加商家', 500, 510, 'location.href=location.href');
		return false;
	}

	//编辑用户	
	function editone(id)
	{
		var tot = new Date().getTime();
        var pm = {'id':id,'t':tot};
		var url = geturl('sysmerchant', 'edit', pm);
		floatPage(url, '编辑商家', 500, 510, 'location.href=location.href');
		return false;
	}
	
	//确认删除用户
	function delone(id)
	{
		verify('你确定要删除该商家吗？', 'ajaxdelone("'+id+'")');
		return false;
	}
	
	//AJAX删除用户
	function ajaxdelone(id)
	{
		var pm = {'t':new Date().getTime()};
        var url = geturl('sysmerchant', 'del', pm);
        $.ajax({
			url: url,
			data: 'id='+id,
			type: 'post',
			dataType: 'html',
			success: function(res){
				//alert(res);
				if(res == 1){
					right('操作已成功！', 'location.href=location.href');
					//TINY.box.hide();
					//messageSuccess('操作已成功！');
					//location.href=location.href;
				}else if(res == 0){
					wrong('用户ID不能为空！');
				}else{
					wrong('系统异常，请联系管理员！');
				}
				return true;
			},
			error: function(){
				wrong('网络异常，请检查网络连接！');
				return false;
			}
		})
	}
	

</script>
	<div class="rightmenu">
        <ul>
		<!--{include menu_right}-->
			<li class="act"><a href="javascript:;" onclick="addone()">添加商家</a></li>
		</ul>
	</div>
	<div class="workspace" id="workspace">
	<!--用户组列表START-->
	<table cellspacing="0" cellpadding="0" border="0" class="list_tbl">
		<tr class="list_tit">
			<td width="40" class="first">ID</td>
            <td width="">登录名称</td>
			<td width="">商家名称</td>
            <td width="">所在城市</td>
            <td width="">收款信息</td>
			<td width="">联系方式</td>
			<td width="60">登录次数</td>
            <td width="90">上次登录信息</td>
            <td width="130">添加时间</td>
			<td width="90">操作</td>
		</tr>
		<!--{if $merchants}-->
		<!--{loop $merchants $index $one}-->
		<tr class="tr_a">
			<td>{$one['id']}</td>
            <td>{$one['username']}</td>
            <td>{$one['title']}</td>
			<td>{$one['city_id']}</td>
            <td>{$one['bankname']},{$one['bankno']},{$one['bankuser']}</td>
			<td>{$one['contact']}<br/>{$one['address']}</td>
			<td>{$one['logins']}</td>
            <td>
            	<!--{if !$one['lastip'] || !$one['lasttime']}-->
				未登录过
				<!--{else}-->
				{$one['lastip']}<br/>${date('Y-m-d H:i',$one['lasttime'])}
				<!--{/if}-->
			</td>
            <td>${date('Y-m-d H:i:s', $one['createtime'])}</td>
			<td>
				<a onclick="javascript:editone({$one['id']});return false;" href="javascript:;">修改</a> |
				<a onclick="javascript:delone({$one['id']});return false;" href="javascript:;">删除</a>
			</td>
		</tr>
		<!--{/loop}-->
		<!--{else}-->
		<tr class="tr_b">
			<td colspan="12" style="color:red">没有记录可以显示！</td>
		</tr>
		<!--{/if}-->
	</table>
	<!--用户组列表END-->
	</div>
<!--{include footer}-->





